<template>
	<view :class="['page',permission]">
		<image class="iwidth" style="height:1500rpx;" :src="imgPath+'/static/big/bg0.jpg'" mode="scaleToFill"></image>
		<image class="iwidth bnt1 breath" @click="navigateTo('activeA')" :src="imgPath+'/static/big/bnt1.png'" mode="scaleToFill"></image>
		<image class="iwidth bnt2 breath delay2" @click="navigateTo('activeB')" :src="imgPath+'/static/big/bnt2.png'" mode="scaleToFill"></image>
	    <view class="loadtxt">活动数据加载中...</view>
			<ActivityEnd ref="activityEnd"/>
	</view>
</template>
<script>
	import http from "@/src/http";
	import platform from "@/src/platform";
	export default {
		data() {
			return {
				permission:'reject',
				confirmRege:false
			}
		},
		onLoad(options) {

		},
		async onShow() {
			const systemInfo = wx.getSystemInfoSync();
			if(systemInfo.environment=='wxwork'){
				uni.redirectTo({
					url:`/pages/permission?identity=3`
				})
				return false;
			}
			let user = await platform.getUserInfo();
			if(user.identity!=1){
				uni.redirectTo({
					url:`/pages/permission?identity=${user.identity}`
				})
				this.permission = 'reject';
			}else{
				this.permission = 'accept';
			}
		},
		methods: {
			loadData(){
				http.initData().then(res=>{
					if(res.data.config.stage == 3){
						this.$refs.activityEnd.show()
					}
					this.confirmRege = (res.data.mbtiUser.mbtiStatus == 2)
					if(this.confirmRege){
						uni.redirectTo({
							url:'/pages/activeB/result/index'
						})
					}else{
						uni.redirectTo({
							url:'/pages/index?name='+active
						})
					}
				})
			},
      navigateTo(active){
		    // if(active=='activeB'){
				// 	return uni.showToast({
				// 		icon:'error',
				// 		title:'暂未开放'
				// 	})
				// }
				uni.redirectTo({
					url:'/pages/index?name='+active
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.loadtxt{
	position: absolute;
	color:#fff;
	text-align: center;
	font-size: 38rpx;
	letter-spacing: 2rpx;
	top:40%;
	left:0;
	width:100%;
	pointer-events: none;
}
.page.reject .iwidth{
	opacity:0
}
.page.accept .iwidth{
	opacity:1
}
.page.accept .loadtxt{
	opacity:0
}
.page .bnt1{
    position: absolute;
	width:638rpx;
	height:206rpx;
	left:46rpx;
	top:618rpx;
}

.page .bnt2{
	position: absolute;
	width:608rpx;
	height:296rpx;
	left:68rpx;
	top:896rpx;
}
</style>
